# -*- coding: utf-8 -*-            
# @Author : chenliang
# @Time : 2024/1/5 13:27
from lib2to3.pgen2 import driver

from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from datetime import datetime



class ProductBlockStorgeLocator:



   """
   my resource 页面
   """
   # my resource tab页面菜单列表
   my_resource_tab_list = (By.CSS_SELECTOR,'[class="antd4-tabs-tab-btn"]')
   # product 列表
   my_resource_product_list = (By.CSS_SELECTOR,'[class="productBtn___2kdzl"]')
   # create_new按钮
   move_storge_create_new = (By.XPATH,'(//button[@class="antd4-btn antd4-btn-primary"])[3]')



   ###################### Block Storge #############################################
   """
    Block Storge 页面
   """
   # iframe
   iframe_block_storage = (By.CSS_SELECTOR,'[id="hj_container"]')
   # 判断进入Block Storge
   #if_enter_block_storage_page = (By.XPATH,'(//div[text()="Block Storage"])[3]')
   if_enter_block_storage_page = (By.XPATH, '(//div[@class="product-title___YYoNb"])')
   # 点击pay as you go
   click_pay_as_you_go = (By.XPATH,'//*[@id="creForm_billingMethod"]/div/div[2]/div/label/span[2]')
   #点击terms of service
   click_terms_of_service = (By.XPATH, '(//span[@class="antd4-checkbox"])')
   #点击buy now
   click_buy_now = (By.XPATH, '(//button[@class="antd4-btn antd4-btn-primary"])')
   #点击pay
   click_pay = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[2]/div[2]/button/span')
   #是否有Payment Successful
   if_payment_succ = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div/div/div/div[3]/div')
   #点击chec korder
   click_check_order = (By.XPATH,'//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div/div/div/div[4]/button[1]/span')

   #点击筛选按钮
   click_select = (By.CSS_SELECTOR, '#rc-tabs-0-panel-259 > div > div > div > div > div > div > div > table > thead > tr > th:nth-child(4) > div > span.antd4-dropdown-trigger.antd4-table-filter-trigger.antd4-dropdown-open > span > svg > path')
   #选择pay as you go
   select_pay_as_you_go = (By.XPATH, '/html/body/div[7]/div/div/div/ul/li[2]')
   #点击ok
   select_ok = (By.XPATH, '/html/body/div[7]/div/div/div/div[2]/button[2]/span')
   #点击菜单...
   click_menu = (By.CSS_SELECTOR, '#rc-tabs-0-panel-259 > div > div > div > div > div > div > div > table > tbody > tr:nth-child(2) > td.antd4-table-cell.antd4-table-cell-fix-right.antd4-table-cell-fix-right-first > div > div.antd4-dropdown-trigger.table-operation-omit > span > svg')
   #点击modify
   #click_modify = (By.XPATH, '/html/body/div[3]/div/div/ul/li[1]/span')
   click_modify = (By.XPATH,'(//span[@class="antd4-dropdown-menu-title-content"])[1]')
   #点击release
   #click_release = (By.CSS_SELECTOR, 'body > div:nth-child(9) > div > div > ul > li:nth-child(2) > span')
   click_release = (By.XPATH,'(//span[@class="antd4-dropdown-menu-title-content"])[2]')
   #再次点击release
   click_release_again = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[2]/div[2]/button/span')
   #点击yes relaese
   click_yes_release = (By.XPATH, '/html/body/div[3]/div/div[2]/div/div[2]/div/div/div[2]/button[2]/span')
   #是否包含release success
   if_release_success = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div[3]/div')
   #点击增加内存大小
   click_add_capacity = (By.CSS_SELECTOR, '#creForm > div:nth-child(2) > div.antd4-row.antd4-form-item.antd4-form-item-with-help > div.antd4-col.antd4-col-24.antd4-form-item-control > div.antd4-form-item-control-input > div > div > div > div > div:nth-child(3) > span > svg')
   #点击terms of service
   #click_terms_of_service_add = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[1]/div[2]/div[2]/div/div[2]/div/div[2]/label/span/input')

   # 回到用户中心
   click_user_center = (By.XPATH, '//*[@id="root"]/section/main/div[1]/div/div[2]/div[1]/div[2]/div[1]/div')

   #是否进入NAS
   if_enter_nas_file_system = (By.XPATH, '(//div[@class="product-title___YYoNb"])')

   #点击ecs选择框
   click_ecs_selector = (By.XPATH, '//*[@id="rc_select_3"]')
   #点击ecs实例
   select_ecs = (By.XPATH, '//*[@id="creForm"]/div[2]/div[2]/div[2]/div[2]/div/div/div/div[1]/div/div[2]/div/div/div/div[2]/div/div/div/div/div')
   #点击续订renew
   click_renew = (By.XPATH, '//*[@id="rc-tabs-0-panel-259"]/div/div/div/div/div/div/div/table/tbody/tr[2]/td[15]/div/div[1]/div/button/span')
   #续订时点击terms of services
   click_renew_terms_of_services = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[1]/div[2]/div/div/div/div[3]/div/div[2]/div/div[2]/label/span/input')

   # 进入Object Storage Service
   if_oss_page = (By.XPATH,'(//div[@class="product-title___YYoNb"])[1]')

   # 菜单按钮
   click_menu_list = (By.CSS_SELECTOR, '[class="product-menu-tigger"]')
   #从菜单点击oss
   click_oss = (By.XPATH, '(//div[text()="Object Storage Service"])')
   #进入到新的页面
   iframe_oss = (By.CSS_SELECTOR,'[id="hj_container"]')
   # 点击buckets
   click_buckets = (By.XPATH, '(//span[@class="oss-rc-text has-ellipsis"])[3]')
   # 点击创建buckets
   click_create_buckets = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-primary"])')
   #选择org name
   select_orgname = (By.XPATH, '(//input[@placeholder="Please Select"])[1]')
   #选择第一个org
   ensure_orgname = (By.XPATH, '(//div[@class="next-tree-node-label next-tree-node-label-selectable"])')
   #选择region
   select_region = (By.XPATH, '(//input[@placeholder="Please Select"])[1]')
   #选择第一个region
   ensure_region = (By.XPATH, '(//span[@class="next-menu-item-text"])')
   # 选择domain name
   select_domain_name = (By.XPATH, '(//input[@placeholder="Please Select"])[1]')
   #选择第一个domain name
   ensure_domain_name = (By.XPATH, '(//span[@class="next-menu-item-text"])[2]')
   # 输入bucket name
   input_bucket_name = (By.XPATH, '(//input[@id="name"])')
   # 点击ok
   click_ok = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-primary"])[2]')
   #是否有建好的bucketname
   if_bucket_name = (By.XPATH, '(//a[@class="bucket-name-link"])[1]')
   # 点击delete
   click_delete_bucket = (By.XPATH, '(//button[@class="next-btn next-small next-btn-normal"])[1]')
   # 点击确认delete
   click_delete_ok = (By.XPATH, '(//button[@class="next-btn next-small next-btn-normal"])[2]')

   #是否有Bucket Name字段
   if_bucket_name_str = (By.XPATH, '(//th[@class="next-table-cell next-table-header-node next-table-header-resizable"])[1]')
   #是否包含org字段
   if_org_str = (By.XPATH, '(//th[@class="next-table-cell next-table-header-node"])[1]')
   # 是否包含ovweview字段
   if_overview_str = (By.XPATH, '(//a[@class="nav-item is-active"])[1]')
   #buckets的basic setting按钮
   click_basic_setting = (By.XPATH, '(//div[@class="nav-item-group"])[3]')
   # Hotlink Protection的setting按钮
   click_hp_setting = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal"])[4]')
   #Hotlink输入框
   input_hotlink = (By.XPATH, '(//textarea[@placeholder="Specify the Referer field in the following format: protocol + host URL. Example: https://www.xxx.com. Separate multiple Referers with newlines."])')
   # 保存hotlink的按钮
   click_save_hotlink = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal"])[4]')
   #是否有设置的hotlink
   if_hotlink = (By.XPATH, '(//ul[@class="referer-list"])')
   # buckets的Object Management按钮
   click_object_management = (By.XPATH, '(//div[@class="nav-item-group"])[2]')
   #Create Directory按钮
   click_create_directory = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal"])[1]')
   # 输入bucket name
   input_directory_name = (By.XPATH, '(//input[@id="name"])')
   #是否有创建的文件夹
   if_directory = (By.XPATH, '(//a[@class="next-btn next-medium next-btn-primary next-btn-text file-name"])')
   # 删除directory
   delete_directory = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal next-btn-text"])[2]')
   # 是否有no data available
   if_no_data = (By.XPATH, '(//div[@class="next-table-empty"])')

   #点击more
   click_more = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal next-btn-text next-menu-btn the-more-button"])')
   # 点击set http header
   click_set_header = (By.XPATH, '(//button[@class="next-btn next-medium next-btn-normal next-btn-text"])[4]')
   #是否保存http header成功
   if_header_succ = (By.XPATH, '(//div[@class="next-message-content"])')

